import scrapy


class CarSpider(scrapy.Spider):
    name = "car"
    allowed_domains = ["www.autohome.com.cn"]
    start_urls = ["https://www.autohome.com.cn/price/brandid_15"]

    def parse(self, response):
        name_list = response.xpath('//div[@class="tw-flex tw-items-center"]//a[@class="tw-text-hover tw-mr-2 tw-text-[18px] tw-font-[500]"]/text()')
        price_list = response.xpath('//div[@class="tw-flex tw-items-center"]//a[@class="tw-text-[16px] tw-font-[500] !tw-text-[#f60]"]/text()')

        item_dict = {key.extract(): value.extract() for key, value in zip(name_list, price_list)}

        print(item_dict)